
//
//  Person.m
//  Day8
//
//  Created by wenjim on 17/10/26.
//  Copyright © 2017年 WenJim. All rights reserved.
//

#import "Person.h"

@implementation Person

-(id)mutableCopyWithZone:(NSZone *)zone
{
    Person * p = [[[self class] allocWithZone:zone] init];
    p.age= _age;
    p.name = _name;
    return p;
}

-(id)copyWithZone:(NSZone *)zone
{
    // 1. 创建一个新的对象
    Person * p = [[[self class] allocWithZone:zone] init];
    // 2.设置当前对象的内容给新的对象
    p.age = _age;
    p.name = _name;
    // 3.返回新的对象
    return p;
}

-(NSString *)description
{
    return [NSString stringWithFormat:@"name = %@,age = %i",_name,_age];
}

@end
